-
Notifications
You must be signed in to change notification settings - Fork 763
Properly handle non-approved revision deletions #6577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the logic for handling deletions of non-approved user revisions by improving the filtering conditions and adding a comprehensive test to verify the behavior.
- Updated deletion logic in the handlers to ensure that only the deleted user’s non-approved revisions are removed while preserving documents and revisions belonging to other users.
- Added a new test case in kitsune/wiki/tests/test_handlers.py to validate the mixed revision deletion scenario.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
kitsune/wiki/tests/test_handlers.py | Added a test case to ensure only the target user's non-approved revisions are deleted and documents with contributions from other users are preserved. |
kitsune/wiki/handlers.py | Updated the on_user_deletion method to refine deletion logic for non-approved revisions and improve contributor handling. |
This doesn't fix mozilla/sumo#2262, because that one is due to cascade deletions via the |
6c59397
to
bc5c440
Compare
@escattone PR updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @akatsoulas, I was wrong about revisions__is_approved=False
being equivalent to current_revision__isnull=True
. We need to use current_revision__isnull=True
in order to ensure that all of the document's revisions are un-approved. Using revisions__is_approved=False
only ensures that at least one is un-approved. Once that's changed, everything looks great.
@akatsoulas I'll make the final tweak I suggested above and merge this. |
No description provided.